<?php
require 'TVB/pms/pdes/common/bootstrap.php';


getList();

/**
 *
 */
function getList()
{
	$page = isset($_REQUEST['page']) ? trim($_REQUEST['page']) : 1;
    $length = isset($_REQUEST['rows']) ? trim($_REQUEST['rows']) : 10;
	$sidx = isset($_REQUEST['sidx']) ? trim($_REQUEST['sidx']) : NULL;
    $sord = isset($_REQUEST['sord']) ? trim($_REQUEST['sord']) : NULL;

    if ($page < 1) {
        $page =	1;
    }

	$start = ($page -1) * $length;
    
    $p = new programme();
    $ret = $p->getAutoPublishList($start, $length, $sidx, $sord);
    empty($ret) && $ret = array();
	echo json_encode($ret);
}
?>
